package Com.amit.Collection;

import java.util.ArrayList;
import java.util.ListIterator;

public class Lab6 {

	
	public static void main(String[] args) {
		
		ArrayList al=new ArrayList();
		al.add("amit1");
		al.add("ajay");
		al.add("amit");
		
		System.out.println("In forward direction");
		
		ListIterator itr=al.listIterator();
		
		System.out.println("Element in second position: "+al.get(2));
		
		while(itr.hasNext())
		{
			System.out.println(itr.next());
		}
		
      System.out.println("Element in backward Direction ");
		
		while(itr.hasPrevious())
		{
			System.out.println(itr.previous());
		}

	}

}
